home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.std.c,comp.lang.c.moderated
- Subject: printf() format extensions - looking for beta testers...
- Date: 10 Apr 1996 10:54:39 -0500
- Organization: Usenet Fact Police (Undercover)
- Approved: seebs
- Message-ID: <4kgljv$l2p@solutions.solon.com>
- Reply-To: seebs@solon.com
- NNTP-Posting-Host: solutions.solon.com
-
- I have submitted a cover sheet to the C9X people for a new feature of printf,
- which would provide user-defined format specifiers, and similar "features".
-
- I have the beginnings of a real implementation to play with, and I am looking
- for beta testers.
-
- The basic idea of the proposed feature is that users would be able to install
- new formats; for instance, the user would
- do something like
- int bangcvt(va_list *ap, char *s, int len, fmtspec *f) {
- strncpy(s, strerror(errno), len);
- s[len - 1] = '\0';
- return strlen(s);
- }
-
- main() {
- format('!', bangcvt);
-
- /* do something which can generate an error */
- fprintf(stderr, "%s: %!\n", "open failed");
- }
- ...
-
- (This example may not be correct, but is expected to give the idea of
- intended usage.)
-
- I would appreciate comments, suggestions, or volunteers. I hope to have
- a tested and portable implementation available "real soon now".
-
- (Obviously, before any adoption occurs, it will be done with functions
- not named printf/fprintf/etc.)
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-